//
//  MemberCheckinViewController.h
//  BVAttend
//
//  Created by Allen Thomas on 10/20/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MeetingMemberRecord.h"
#import "AttendanceConnection.h"
#import "JoinUnenrollConnection.h"
#import "AttendCell.h"

@interface MemberCheckinViewController : UIViewController<UITableViewDelegate, UITableViewDataSource, AttendanceConnectionDelegate, JoinUnenrollConnectionDelegate> {
	IBOutlet UITableView* theTableView;
	NSOperationQueue *queue;
	
	NSDate *meetingDate;
	NSString *organizationId;
	NSString *organizationName;
	
	NSMutableArray *meetingRoll;
	NSString *meetingId;
	
	int members; 
	int visitors;
	
	UIImage *checked;
	UIImage *unchecked;
	
	UIView *loadingView;
	BOOL loading;
	
	NSMutableDictionary *attendanceConnectionsInProgress; 
 	JoinUnenrollConnection *rollConnection;
}

@property (nonatomic, retain) NSDate *meetingDate;
@property (nonatomic, retain) NSString *organizationId;
@property (nonatomic, retain) NSString *organizationName;

@property (nonatomic, retain) UITableView* theTableView;
@property (nonatomic, retain) NSString *meetingId;

@property (nonatomic, retain) NSMutableDictionary *attendanceConnectionsInProgress; 

@property (nonatomic, retain) NSMutableArray *meetingRoll;


- (void)getMeetingMembers;
- (void)recordVisit: (NSString *)peopleId;
- (void)addNewPerson:(NSString *)paramString; 

- (void)getMeetingMembers_callback:(NSData *)data;
- (void)getMeetingMembers_error_callback:(NSError *)error;
- (void)handleElement_RollList: (NSDictionary*) attributes;
- (void)handleElement_Person: (NSDictionary*) attributes;
- (void)parseXml:(NSData *)data;

- (void)setupIndexData;

- (void) addSpinner:(AttendCell*)cell;

- (void)addVisitor:(id)sender;
- (void)startChangeAttendance:(MeetingMemberRecord *)meetingMemberRecord forIndexPath:(NSIndexPath *)indexPath;
- (void)attendanceChangeFailed:(NSIndexPath *)indexPath;
- (void)attendanceDidChange:(NSIndexPath *)indexPath;

- (void)startJoinUnenroll:(MeetingMemberRecord *)meetingMemberRecord forIndexPath:(NSIndexPath *)indexPath;
- (void)joinUnenrollCallback:(NSIndexPath *)indexPath;
- (void)joinUnenrollFailed:(NSIndexPath *)indexPath;

- (MeetingMemberRecord*)getPerson:(NSIndexPath *)indexPath;

@end
